package com.tianji.StragyHttp.enumr;


import lombok.Getter;

/**
 * 平台枚举类
 */
@Getter
public enum PlatformEnum {

    TB("TB", "淘宝"),
    JD("JD", "京东"),
    DY("DY", "抖音"),
    YZ("YZ", "有赞"),
    KS("KS", "快手"),
    YUNZHOU("YUNZHOU", "云舟全域系统"),
    HYT("HYT","会员通"),
    NULL("","")
    ;

    private String code;
    private String name;

    PlatformEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static PlatformEnum getByCode(String code) {
        for (PlatformEnum platformEnum : PlatformEnum.values()) {
            if (platformEnum.getCode().equals(code)) {
                return platformEnum;
            }
        }
        return NULL;
    }

    public static String getByName(String name) {
        for (PlatformEnum platformEnum : PlatformEnum.values()) {
            if (platformEnum.getName().equals(name)) {
                return platformEnum.getCode();
            }
        }
        return NULL.getCode();
    }
}
